<include file="public@header"/>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Subscribe/index')}">试听课列表</a></li>
        <li class="active"><a href="{:url('Subscribe/add')}">添加试听课</a></li>
    </ul>
    <form action="{:url('Subscribe/add')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
        <div class="row">
            <div class="col-md-9">
                <table class="table table-bordered">
                    <tr>
                        <th width="15%">分类<span class="form-required">*</span></th>
                        <td>
                            <select class="form-control" name="cate_id">
                                <option value="">请选择分类</option>
                                <foreach name="cateList" item="c">
                                    <option value="{$c.cate_id}">{$c.cate_name}</option>
                                </foreach>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th width="15%">选择机构<span class="form-required">*</span></th>
                            <td>
                                <select class="form-control" name="admin_id" id="userList">
                                    <option value="">请选择机构</option>
                                    <foreach name="userList" item="c">
                                        <option value="{$c.id}">{$c.user_nickname}</option>
                                    </foreach>
                                </select>
                        </td>
                    </tr>
                    <tr>
                        <th>试听课名称<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="subscribe_name" placeholder="请输入试听课名称"/>
                        </td>
                    </tr>
                    <tr>
                        <th>价格<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="number" name="price"/>
                        </td>
                    </tr>
                    <tr>
                        <th>库存数<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="number" name="sku"/>
                        </td>
                    </tr>
                    <tr>
                        <th>团购价格<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="number" name="assemble_price"/>
                        </td>
                    </tr>
                    <tr>
                        <th>分佣比例<span class="form-required">*</span></th></th>
                        <td>
                            <input class="form-control" type="number" name="proportion"/>
                        </td>
                    </tr>
                    <tr>
                        <th>团购人数<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="number" name="total_num"/>
                        </td>
                    </tr>
                    <tr>
                        <th>团购结束时间<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control js-bootstrap-datetime" type="text" name="end_time"
                                   value="">
                        </td>
                    </tr>

                    <tr>
                        <th>摘要</th>
                        <td>
                            <textarea class="form-control" name="desc" style="height: 50px;"
                                      placeholder="请填写摘要"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <th>内容</th>
                        <td>
                            <script type="text/plain" id="content" name="content"></script>
                        </td>
                    </tr>

                    <!--
                    <tr>
                        <th>附件</th>
                        <td>
                            <ul id="files" class="pic-list list-unstyled form-inline">
                            </ul>
                            <a href="javascript:uploadMultiFile('附件上传','#files','files-item-tpl','file');"
                               class="btn btn-sm btn-default">选择文件</a>
                        </td>
                    </tr>
                    <tr>
                        <th>音频</th>
                        <td class="form-inline">
                            <input id="file-audio" class="form-control" type="text" name="post[more][audio]"
                                   value="" placeholder="请上传音频文件" style="width: 200px;">

                            <a href="javascript:uploadOne('文件上传','#file-audio','audio');">上传</a>
                        </td>
                    </tr>
                    <tr>
                        <th>视频</th>
                        <td class="form-inline">
                            <input id="file-video" class="form-control" type="text" name="post[more][video]"
                                   value="" placeholder="请上传视频文件" style="width: 200px;">
                            <a href="javascript:uploadOne('文件上传','#file-video','video');">上传</a>
                        </td>
                    </tr>-->
                </table>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">添加</button>
                        <a class="btn btn-default" href="javascript:history.back(-1)">返回</a>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <table class="table table-bordered">
                    <tr>
                        <th><b>缩略图</b></th>
                    </tr>
                    <tr>
                        <td>
                            <div style="text-align: center;">
                                <input type="hidden" name="image" id="thumbnail" value="">
                                <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                    <img src="/themes/admin_simpleboot3/public/assets/images/default-thumbnail.png"
                                         id="thumbnail-preview"
                                         width="135" style="cursor: pointer"/>
                                </a>
                                <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>相册</th>

                    </tr>
                    <tr>
                        <td>
                            <ul id="photos" class="pic-list list-unstyled form-inline"></ul>
                            <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
                               class="btn btn-default btn-sm">选择图片</a>
                        </td>
                    </tr>
                </table>

            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="/static/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="/static/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/static/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }
    })
</script>
</body>
</html>
